package com.sz.web.account.control;

import com.sz.web.account.entity.AccountRole;
import com.sz.web.account.service.AccountRoleService;
import com.sz.web.common.pojo.ReturnPojo;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 角色
 */
@RequestMapping(value = "/account")
@Controller
public class AccountRoleController {

    @Resource
    private AccountRoleService accountRoleService;

    /**
     * 角色列表查询
     * @return
     */
    @GetMapping(value = "/role/query")
    public ReturnPojo roleQuery(){
        return accountRoleService.roleQuery();
    }

    /**
     * 角色新增
     * @param accountRole
     * @return
     */
    @PostMapping(value = "/role/add")
    @ResponseBody
    public ReturnPojo roleAdd(@RequestBody AccountRole accountRole){
        return accountRoleService.roleAdd(accountRole);
    }

    /**
     * 角色删除-byId
     * @param accountRole
     * @return
     */
    @PostMapping(value = "/role/del")
    @ResponseBody
    public ReturnPojo roleDel(@RequestBody AccountRole accountRole){
        return accountRoleService.roleDel(accountRole.getId());
    }
}
